package io.github.wppli.domain.posts.model.valobj;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户帖子行为类型: 'LIKE', 'COMMENT', 'SHARE', 'PUBLISH'
 * @author li--jiaqiang 2025−03−16
 */
@Getter
@AllArgsConstructor
public enum UserPostsBehaviorType {

    // 喜欢-点赞
    LIKE("LIKE", 1.0f),
    // 评论
    COMMENT("COMMENT", 2.0f),
    // 收藏
    COLLECT("COLLECT", 3.0f),
    // 分享
    SHARE("SHARE", 4.0f),
    // 发布
    PUBLISH("PUBLISH", 5.0f);

    private final String value;
    private final float score;

    public static UserPostsBehaviorType fromValue(String value) {
        for (UserPostsBehaviorType type : UserPostsBehaviorType.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown UserPostsBehaviorType: " + value);
    }
}